package com.base.controller.pms;

import com.alibaba.fastjson.JSONObject;
import com.base.api.pms.PmsFollowItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping(value = "/pms", produces = "application/json;charset=UTF-8")
public class PmsFollowItemController {
    @Autowired
    private PmsFollowItemService followItemService;

    @PostMapping("/getFollowItem")
    public String GetSqlQuery(@RequestBody Map<String,Object> params) {
        return followItemService.getFollowItem(params);
    }

    @PostMapping("/saveFollowItem")
    public String saveSqlQuery(@RequestBody Map<String,Object> params) {
        try {
            return followItemService.saveFollowItem(params);
        } catch (Exception e) {
            Map<String,Object> map = new HashMap<>() ;
            map.put("code", "error");
            map.put("msg", e.getMessage());
            return JSONObject.toJSONString(map);
        }
    }

}
